package xj.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 
 * @author zhangxudong
 *
 */
public class TimeUtil {

	public final static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
	
	public static String getTime() {
		SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT);
		return sdf.format(new Date());		
	}
	
	public static String getTime(String dateFormat) {
		SimpleDateFormat sdf=new SimpleDateFormat(dateFormat);
		return sdf.format(new Date());	
	}
	
	public static String getTime(String dateFormat, long currentTime) {
		SimpleDateFormat sdf=new SimpleDateFormat(dateFormat);
		return sdf.format(new Date(currentTime));	
	}
	
	public static String getyyyyMMddTime() {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd");
		return sdf.format(new Date());	
	}
	
	public static String getHHmmssTime() {
		SimpleDateFormat sdf=new SimpleDateFormat("HHmmss");
		return sdf.format(new Date());	
	}
	
	public static void main(String[] args) {
		System.out.println(getyyyyMMddTime());
		System.out.println(getHHmmssTime());
	}
}
